#include "main.h"
pthread_mutex_t mutex1=PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2=PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex3=PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex4=PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond =PTHREAD_COND_INITIALIZER;
struct Env recv;
int fd;
int flag=1;
que_head *hq;
int main(int argc, const char *argv[])
{
	fd=open("/dev/ttyUSB0",O_RDWR);
 	serial_init(fd);
	que_creat(&hq);
	pthread_t tid1,tid2,tid3,tid4;
	pthread_t tid5,tid6;

	pthread_create(&tid1,NULL,zig_read,NULL);
	pthread_create(&tid2,NULL,pick,NULL);
	pthread_create(&tid3,NULL,sqlite_back,NULL);
	pthread_create(&tid4,NULL,shrmem_back,NULL);
	//---------发送部分的线程---------------
	pthread_create(&tid5,NULL,msgque_get,NULL);
	pthread_create(&tid6,NULL,zig_write,NULL);

	pthread_mutex_lock(&mutex1);

	pthread_detach(tid1);
	pthread_detach(tid2);
	pthread_detach(tid3);
	pthread_detach(tid4);
	//---------发送部分的线程---------------
	pthread_detach(tid5);
	pthread_detach(tid6);

	while(1);
	return 0;
}
